/*-----------------------------------------------File Info------------------------------------------------
** File Name:               i2c_user.h
** Last modified date:      2016.07.22
** Last version:            V0.1
** Description:             
**--------------------------------------------------------------------------------------------------------            
** Created date:            2016.09.07
** author:                  YLY
** Version:                 V0.1
** Descriptions:            I2c驱动
**--------------------------------------------------------------------------------------------------------
*/
#ifndef __DMA_USER_H_
#define __DMA_USER_H_

#include "bspConfig.h"

//#define DMA_EN
/*   硬件相关头文件     */
#ifdef DMA_EN
typedef enum
{
	DMA_READ,
	DMA_WRITE,
}teDmaRW;

typedef enum
{
	DMA_FAIL,
	DMA_HALF_FINISH,
	DMA_SUCCESS,	
}teDmaCallBackSta;
typedef void (* tpDmaCallBack)(teDmaCallBackSta eCb);

typedef enum
{
	DMA_CLOSE=0,
	DMA_OPEN
}teDmaRunSta;

typedef struct
{
	teDmaRunSta eCH0Sta;		
	teDmaRunSta eCH1Sta;	
	teDmaRunSta eCH2Sta;	
	teDmaRunSta eCH3Sta;	
	teDmaRunSta eCH4Sta;
#if BSP_MCU_TYPE == BSP_MCU_GD32F3x0
	teDmaRunSta eCH5Sta;	
	teDmaRunSta eCH6Sta;		
#endif	
	tpDmaCallBack ptvCH0Cb;
	tpDmaCallBack ptvCH1Cb;
	tpDmaCallBack ptvCH2Cb;
	tpDmaCallBack ptvCH3Cb;
	tpDmaCallBack ptvCH4Cb;
#if BSP_MCU_TYPE == BSP_MCU_GD32F3x0
	tpDmaCallBack ptvCH5Cb;
	tpDmaCallBack ptvCH6Cb;		
#endif		
}tsDmaSta;

extern bool dmaInit(dma_channel_enum channelx, teDmaRW eRW, 
				     uint8_t *pMemory, uint32_t periph_addr, uint32_t number, tpDmaCallBack ptCb);

extern void damDinit(dma_channel_enum channelx);
extern teDmaRunSta eGetDmaSta(dma_channel_enum channelx);
extern void setDmaSta(dma_channel_enum channelx, teDmaRunSta eSta);
extern void setDmaCallBack(dma_channel_enum channelx, tpDmaCallBack ptCb);
#endif
/*注意：
DMA通道不可随意配置
	请阅读用户手册，表8-3. DMA各通道请求表
*/

#endif		//__I2C_USER_H_






